package com.source.quartz.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @Author wengqy
 * @Date 2020/12/12
 */
@Controller
@Api("SessionController相关的api")
public class SessionController {

    @RequestMapping(value="/uid",method = RequestMethod.GET)
    public @ResponseBody
    String uid(HttpSession session) {
        return "sessionId:" + session.getId();
        // sessionId:33ede61b-e2f7-413b-b4ef-416863e634d7

      /*  127.0.0.1:6379> keys *
        1) "spring:session:sessions:33ede61b-e2f7-413b-b4ef-416863e634d7"
        2) "spring:session:sessions:expires:33ede61b-e2f7-413b-b4ef-416863e634d7"
        3) "spring:session:expirations:1609547880000"*/

    }


    @RequestMapping(value="/hello",method = RequestMethod.GET)
    public @ResponseBody
    @ApiOperation("hello")
    String hello( ) {
        return "hello:";
    }
}
